home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / maintenance.tab.p < prev    next >
Text File  |  2003-01-03  |  17KB  |  507 lines

  1. {
  2.   X = -230;
  3.   Y = 60;
  4.   state = 0;
  5.   rest_x = -230;
  6.   expand_x = -20;
  7.   Hidden = 1;
  8.   
  9.   
  10.   ScriptID = script {
  11.     @loaded {
  12.       resid plateID;
  13.       resid tabID;
  14.       int   plate_width;
  15.       
  16.       plateID = GuiChildByName(SELF, "plate");
  17.       tabID   = GuiChildByName(SELF, "tab");
  18.  
  19.       plate_width = ResPropGetInt(plateID, "Width");
  20.       ResPropSetInt(SELF, "rest_x", - plate_width);
  21.       
  22.       ResPropSetInt(tabID, "X", plate_width - 4);
  23.     }
  24.   }; 
  25.   
  26.   ChildID = {
  27.  
  28.     GuiAnimation("plate") {
  29.       AnimationID = "gui/dash/tab/plate/plate.pcx";
  30.       X = 0;
  31.       Width = 230;
  32.       Height = 180;
  33.     },
  34.     GuiAnimation("tab") {
  35.       X = 235;
  36.       Y = 118;
  37.       AnimationID = "gui/dash/tab/maintenance/maintenance_off.pcx";
  38.       ScriptID = script {
  39.         @activate {
  40.           resid Parent;
  41.           resid Player;
  42.           resid Game;
  43.           Game = ResByName("Game");
  44.           Player = ResPropGetResID(ResByName("Game"),"game_cur_player");          
  45.           Parent = GuiParent(SELF);
  46.  
  47.           if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
  48.             ResPropSetResID(Player,"truck_tab_expanded",RES_INVALID);
  49.             ResPropSetInt( GuiSiblingByName("no_repairs_needed"), "Hidden", TRUE );
  50.             ResPropSetInt( GuiSiblingByName("repairs_needed"), "Hidden", TRUE);
  51.             ResPropSetInt( GuiSiblingByName("no_flat_tire"), "Hidden", TRUE );
  52.             ResPropSetInt( GuiSiblingByName("have_flat_tire"), "Hidden", TRUE );            
  53.           } else {
  54.             ResPropSetResID(Player,"truck_tab_expanded",Parent);
  55.             GuiToFront(Parent);
  56.           }
  57.         }
  58.         @animate {
  59.           resid Parent;
  60.           int state;
  61.           int truck_broken;
  62.           int truck_tire_flat;
  63.           resid Player;
  64.           resid Game;
  65.           Game = ResByName("Game");
  66.           Player = ResPropGetResID(Game,"game_cur_player");          
  67.           Parent = GuiParent(SELF);
  68.  
  69.           ResPropAlias(Player,"truck_broken","truck_broken");
  70.           ResPropAlias(Player,"truck_tire_flat","truck_tire_flat");
  71.           
  72.  
  73.           if (truck_tire_flat == 1) {
  74.             if (ResPropGetResID(ResByName("maintenance.tab/tab"),"AnimationID") != ResByName("gui/dash/tab/maintenance/maintenance_on.pcx")) {
  75.               ResPropSetResID(ResByName("maintenance.tab/tab"),"AnimationID",ResByName("gui/dash/tab/maintenance/maintenance_on.pcx"));
  76.             }
  77.           }
  78.  
  79.  
  80.  
  81.  
  82.           if ( ResPropGetResID(Player,"truck_tab_expanded") == Parent) {
  83.             ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"expand_x"));
  84.             ResPropSetInt(GuiSiblingByName("plate"),"Hidden",FALSE);
  85.               /* if a tire is flat then show fix message */
  86.               if (truck_tire_flat == 1) {
  87.                 ResPropSetInt( GuiSiblingByName("no_flat_tire"), "Hidden", TRUE );
  88.                 ResPropSetInt( GuiSiblingByName("have_flat_tire"), "Hidden", FALSE );
  89.               } else {
  90.                 ResPropSetInt( GuiSiblingByName("no_flat_tire"), "Hidden", FALSE );
  91.                 ResPropSetInt( GuiSiblingByName("have_flat_tire"), "Hidden", TRUE );
  92.               }          
  93.               
  94.               /* if truck is broken then show fix message*/
  95.               if (truck_broken == 1) {
  96.                 ResPropSetInt( GuiSiblingByName("no_repairs_needed"), "Hidden", TRUE );
  97.                 ResPropSetInt( GuiSiblingByName("repairs_needed"), "Hidden", FALSE );
  98.               } else {
  99.                 ResPropSetInt( GuiSiblingByName("no_repairs_needed"), "Hidden", FALSE );
  100.                 ResPropSetInt( GuiSiblingByName("repairs_needed"), "Hidden", TRUE );               
  101.               }  
  102.           } else {
  103.             ResPropSetInt(GuiSiblingByName("plate"),"Hidden",TRUE);
  104.             ResPropSetInt(Parent,"X",ResPropGetInt(Parent,"rest_x"));
  105.           }
  106.           
  107.  
  108.  
  109.  
  110.           
  111.         }
  112.       }
  113.       },
  114.       
  115.     GuiLayer("chains_layer") {
  116.       X = 25;
  117.       Y = 0;
  118.  
  119.       ChildID = {
  120.             GuiTextInput("chains_label") {
  121.           X = 0;
  122.           Y = 5;
  123.           Width = 185;
  124.           Height = 45;
  125.           WordWrap = TRUE;
  126.           InputDisabled = TRUE;
  127.           FontID = "font/tab_w_on_g.tf";             
  128.         },  
  129.         
  130.             GuiTextInput("chains_message") {
  131.           X = 0;
  132.           Y = 20;
  133.           Width = 190;
  134.           Height = 40;
  135.           WordWrap = TRUE;
  136.           InputDisabled = TRUE;
  137.           FontID = "font/verdana_9.tf";
  138.           ScriptID = Script {
  139.             @animate {
  140.               resid Player;
  141.               resid Game;
  142.               int truck_chains_on;
  143.               str precip;
  144.               str text;
  145.               Game = ResByName("Game");
  146.               Player = ResPropGetResID(Game,"game_cur_player");  
  147.               ResPropAlias(Player,"truck_chains_on","truck_chains_on");
  148.               ResPropAlias(Player,"weather_precip","precip");
  149.               ResPropAlias(SELF,"InputText","text");
  150.               ResPropSetStr(GuiSiblingByName("chains_label"),"InputText",MangleSIDToStr(163/*"Chains"*/));
  151.               
  152.               if ( (truck_chains_on == 0) && StrExact("s",precip) ) {
  153.                 text = MangleSIDToStr(164/*"There's snow on the road. You should put chains on your tires."*/);
  154.               }     
  155.  
  156.               if ( (truck_chains_on == 1) && StrExact("s",precip) ) {
  157.                 text = MangleSIDToStr(165/*"Chains improve traction on snowy roads."*/);
  158.               }     
  159.  
  160.               if ( (truck_chains_on == 0) && (StrExact("n",precip) || StrExact("r",precip)) ) {
  161.                 text = MangleSIDToStr(166/*"Chains improve traction in the snow, but they damage bare roads."*/);
  162.               }
  163.  
  164.               if ( (truck_chains_on == 1) && (StrExact("n",precip) || StrExact("r",precip)) ) {
  165.                 text = MangleSIDToStr(167/*"Chains damage bare roads. Take them off to avoid getting a ticket."*/);
  166.               }
  167.  
  168.               
  169.                    
  170.             }
  171.           };
  172.         },
  173.         
  174.         GuiButtonGroup("on_button") {
  175.           X = 80;
  176.           Y = 8;
  177.           RadioGroupID = 1;
  178.           ScriptID = Script {
  179.             @show {
  180.               resid Player;
  181.               resid Game;
  182.               int truck_chains_on;
  183.               Game = ResByName("Game");
  184.               Player = ResPropGetResID(Game,"game_cur_player");  
  185.               ResPropAlias(Player,"truck_chains_on","truck_chains_on");
  186.  
  187.               if (truck_chains_on == 1) {
  188.  
  189.                 ResPropSetResID(SELF,"RadioGroupSelectedID",SELF);
  190.               } else {
  191.                 ResPropSetResID(SELF,"RadioGroupSelectedID",GuiSiblingByName("off_button"));
  192.               }   
  193.             }
  194.             @activate {
  195.               resid Player;
  196.               resid Game;
  197.               resid ChainsOnSound;
  198.               int truck_chains_on;
  199.               int time_now;             
  200.               int hunger;
  201.               int fatigue;
  202.               
  203.               Game = ResByName("Game");
  204.  
  205.               Player = ResPropGetResID(Game,"game_cur_player");  
  206.               ResPropAlias(Player,"truck_chains_on","truck_chains_on");
  207.               ResPropAlias(Player,"time_now","time_now");
  208.               ResPropAlias(Player,"player_hunger","hunger");
  209.               ResPropAlias(Player,"player_fatigue","fatigue");  
  210.               
  211.               if (truck_chains_on == 1) {
  212.                 stop;
  213.               }
  214.               
  215.               ChainsOnSound = ResByNAme("sound/chains_on.wav");
  216.               ResParseEvent(ResByName("dash.gl/brake_pedal"),"@activate");
  217.               truck_chains_on = 1;
  218.               time_now += 7200;       
  219.               fatigue = Min(ResPropGetInt(Game,"game_fatigue_limit"), fatigue + 7200);
  220.               hunger  = Min(ResPropGetInt(Game,"game_hunger_limit"), hunger + 7200); 
  221.               AudioPlay(ChainsOnSound);
  222.               ResParseEvent(ResByName("common/set_night_day.c4"),"@set_night_day");            
  223.             }
  224.           };
  225.           ChildID = {
  226.                   GuiButton("on_false") {
  227.                     HorizontalAlign = RIGHTOF;
  228.               HorizontalPadding = 6;
  229.                   StyleID = "gui/bs/radiounsel.gbs";
  230.                   TextID = Mangle(168/*"on"*/);
  231.               FontID = "font/tab_w_on_g.tf";    
  232.                  },          
  233.     
  234.                 GuiButton("on_true") {
  235.                     HorizontalAlign = RIGHTOF;
  236.               HorizontalPadding = 6;            
  237.                   StyleID = "gui/bs/radiosel.gbs";
  238.                   TextID = Mangle(169/*"on"*/);
  239.               FontID = "font/tab_w_on_g.tf";      
  240.                  }        
  241.           };
  242.         },        
  243.         
  244.         GuiButtonGroup("off_button") {
  245.           X = 130;
  246.           Y = 8;
  247.           RadioGroupID = 1;
  248.           ScriptID = Script {
  249.             @activate {
  250.               resid Player;
  251.               resid Game;
  252.               resid ChainsOffSound;              
  253.               int truck_chains_on;
  254.               int time_now;
  255.               int hunger;
  256.               int fatigue;
  257.               
  258.               Game = ResByName("Game");
  259.               
  260.             
  261.               Player = ResPropGetResID(Game,"game_cur_player");  
  262.               ResPropAlias(Player,"truck_chains_on","truck_chains_on");
  263.               ResPropAlias(Player,"time_now","time_now");   
  264.               ResPropAlias(Player,"player_hunger","hunger");
  265.               ResPropAlias(Player,"player_fatigue","fatigue");  
  266.  
  267.               if (truck_chains_on == 0) {
  268.                 stop;
  269.               }
  270.               
  271.               ChainsOffSound = ResByNAme("sound/chains_off.wav"); 
  272.               ResParseEvent(ResByName("dash.gl/brake_pedal"),"@activate");               
  273.               truck_chains_on = 0;
  274.               time_now += 7200;
  275.               fatigue = Min(ResPropGetInt(Game,"game_fatigue_limit"), fatigue + 7200);
  276.               hunger = Min(ResPropGetInt(Game,"game_hunger_limit"), hunger + 7200);
  277.               AudioPlay(ChainsOffSound); 
  278.               ResParseEvent(ResByName("common/set_night_day.c4"),"@set_night_day");   
  279.             }
  280.           };
  281.           ChildID = {
  282.                   GuiButton("off_false") {
  283.                     HorizontalAlign = RIGHTOF;
  284.               HorizontalPadding = 6;
  285.                   StyleID = "gui/bs/radiounsel.gbs";
  286.                   TextID = Mangle(170/*"off"*/);
  287.               FontID = "font/tab_w_on_g.tf";    
  288.                  },          
  289.     
  290.                 GuiButton("off_true") {
  291.                     HorizontalAlign = RIGHTOF;
  292.               HorizontalPadding = 6;            
  293.                   StyleID = "gui/bs/radiosel.gbs";
  294.                   TextID = Mangle(171/*"off"*/);
  295.               FontID = "font/tab_w_on_g.tf";      
  296.                  }        
  297.           };
  298.         },         
  299.         
  300.         GuiButton("chains_button") {
  301.           X = 40;
  302.           Y = 20;
  303.           Hidden = TRUE;
  304.           StyleID = "gui/dash/tab/button/tab.gbs";
  305.           FontID = "font/tab_button.tf";
  306.           Width = 120;
  307.           AutoSize = Height;
  308.           ScriptID = Script {
  309.             @show {
  310.  
  311.             }
  312.             @activate { 
  313.               resid Player;
  314.               resid Game;
  315.               int truck_chains_on;
  316.               int text_id;
  317.               Game = ResByName("Game");
  318.               Player = ResPropGetResID(Game,"game_cur_player");  
  319.               ResPropAlias(Player,"truck_chains_on","truck_chains_on");
  320.               ResPropAlias(SELF,"TextID","text_id");
  321.               if (truck_chains_on == 1) {
  322.                 text_id = MangleSIDToSID(172/*"Put Chains On"*/);
  323.                 truck_chains_on = 0;
  324.               } else {
  325.                 text_id = MangleSIDToSID(173/*"Take Chains Off"*/);
  326.                 truck_chains_on = 1;
  327.               }
  328.               
  329.                              
  330.             }
  331.           }
  332.         }
  333.  
  334.       };
  335.     },
  336.           
  337.     GuiAnimation("line") {
  338.       AnimationID = "gui/dash/tab/line/line.pcx";
  339.       X = 25;
  340.       Y = 55;
  341.     },
  342.     
  343.     GuiLayer("no_flat_tire") {
  344.       X = 25;
  345.       Y = 55;
  346.  
  347.       ChildID = {
  348.             GuiTextInput("no_flat_tire_label") {
  349.           X = 0;
  350.           Y = 5;
  351.           Width = 185;
  352.           Height = 45;
  353.           WordWrap = TRUE;
  354.           InputDisabled = TRUE;
  355.           FontID = "font/tab_w_on_g.tf";          
  356.         },  
  357.             GuiTextInput("no_flat_tire_message") {
  358.           X = 0;
  359.           Y = 20;
  360.           Width = 190;
  361.           Height = 40;
  362.           WordWrap = TRUE;
  363.           InputDisabled = TRUE;
  364.           FontID = "font/verdana_9.tf";
  365.           ScriptID = Script {
  366.             @animate {
  367.               ResPropSetStr(GuiSiblingByName("no_flat_tire_label"),"InputText",MangleSIDToStr(174/*"No Flat Tire"*/));
  368.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(175/*"Your tires have no holes and have good tread."*/));
  369.             }
  370.           };
  371.         }
  372.         
  373.         
  374.       };
  375.     },
  376.  
  377.     GuiLayer("have_flat_tire") {
  378.       X = 25;
  379.       Y = 55;
  380.  
  381.       ChildID = {
  382.             GuiTextInput("have_flat_tire_label") {
  383.           X = 0;
  384.           Y = 5;
  385.           Width = 185;
  386.           Height = 45;
  387.           WordWrap = TRUE;
  388.           InputDisabled = TRUE;
  389.           FontID = "font/tab_w_on_g.tf";          
  390.         },  
  391.        
  392.             GuiTextInput("have_flat_tire_message") {
  393.           X = 0;
  394.           Y = 20;
  395.           Width = 190;
  396.           Height = 40;
  397.           WordWrap = TRUE;
  398.           InputDisabled = TRUE;
  399.           FontID = "font/verdana_9.tf";
  400.           ScriptID = Script {
  401.             @animate {
  402.               ResPropSetStr(GuiSiblingByName("have_flat_tire_label"),"InputText",MangleSIDToStr(176/*"You have a flat tire!"*/));
  403.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(177/*""*/));
  404.             }
  405.           };
  406.         },
  407.         GuiButton("fix_flat") {
  408.           X = 45;
  409.           Y = 30;
  410.           TextID = Mangle(178/*"Fix Yourself"*/);
  411.           StyleID = "gui/dash/tab/button/tab.gbs";
  412.           FontID = "font/tab_button.tf";
  413.           Width = 120;
  414.           AutoSize = Height;
  415.           ScriptID = Script {
  416.             @activate { 
  417.               resid Player;
  418.               resid Game;
  419.               Game = ResByName("Game");
  420.               Player = ResPropGetResID(ResByName("Game"),"game_cur_player");
  421.  
  422.               AudioPlay(ResByName("sound/fix_flat.wav"));
  423.               ResPropSetInt(Player,"truck_tire_flat",0);
  424.               ResPropSetInt(Player,"time_now",(ResPropGetInt(Player,"time_now") + 10800) /* 3 hours */);
  425.               ResPropSetInt(Player,"player_fatigue",(ResPropGetInt(Player,"player_fatigue") + 21600) /* 6 hours */);
  426.               ResPropSetStr(ResByName("dash.gl/message"), "InputText", MangleSIDToStr(179/*"After struggling for a few hours, you manage to fix the flat yourself."*/));
  427.               ResPropSetInt(ResByName("dash.gl/message"), "timeout", CVarGetInt("framerate") * 6);
  428.               ResPropSetResID(ResByName("maintenance.tab/tab"),"AnimationID",ResByName("gui/dash/tab/maintenance/maintenance_off.pcx"));    
  429.             }
  430.           }
  431.         }        
  432.       };
  433.     },
  434.  
  435.     GuiAnimation("no_repair_line") {
  436.       AnimationID = "gui/dash/tab/line/line.pcx";
  437.       X = 25;
  438.       Y = 115;
  439.     },   
  440.  
  441.     GuiLayer("no_repairs_needed") {
  442.       X = 25;
  443.       Y = 115;
  444.  
  445.       ChildID = {
  446.   
  447.             GuiTextInput("no_repairs_needed_label") {
  448.           X = 0;
  449.           Y = 5;
  450.           Width = 185;
  451.           Height = 40;
  452.           WordWrap = TRUE;
  453.           InputDisabled = TRUE;
  454.           FontID = "font/tab_w_on_g.tf";          
  455.         },      
  456.             GuiTextInput("no_repairs_needed_message") {
  457.           X = 0;
  458.           Y = 20;
  459.           Width = 190;
  460.           Height = 50;
  461.           WordWrap = TRUE;
  462.           InputDisabled = TRUE;
  463.           FontID = "font/verdana_9.tf";
  464.           ScriptID = Script {
  465.             @animate {
  466.               ResPropSetStr(GuiSiblingByName("no_repairs_needed_label"),"InputText",MangleSIDToStr(180/*"No repairs needed."*/));
  467.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(181/*"Your truck is running smoothly."*/));
  468.             }
  469.           };
  470.         }   
  471.       };
  472.     },
  473.     GuiLayer("repairs_needed") {
  474.       X = 25;
  475.       Y = 115;
  476.  
  477.       ChildID = {
  478.   
  479.             GuiTextInput("repairs_needed_label") {
  480.           X = 0;
  481.           Y = 5;
  482.           Width = 185;
  483.           Height = 40;
  484.           WordWrap = TRUE;
  485.           InputDisabled = TRUE;
  486.           FontID = "font/tab_w_on_g.tf";          
  487.         },      
  488.             GuiTextInput("repairs_needed_message") {
  489.           X = 0;
  490.           Y = 20;
  491.           Width = 190;
  492.           Height = 50;
  493.           WordWrap = TRUE;
  494.           InputDisabled = TRUE;
  495.           FontID = "font/verdana_9.tf";
  496.           ScriptID = Script {
  497.             @animate {
  498.               ResPropSetStr(GuiSiblingByName("repairs_needed_label"),"InputText",MangleSIDToStr(182/*"Repairs Needed"*/));
  499.               ResPropSetStr(SELF,"InputText",MangleSIDToStr(183/*"Your truck needs repairs."*/));
  500.             }
  501.           };
  502.         }   
  503.       };
  504.     }    
  505.   };
  506. }
  507.